#include <string>
#include <filesystem>
#include <iostream>
#include <fstream>

#include "NetWork/ThreadSafeQueue.h"
#include "Catch2.v3/catch_amalgamated.hpp"


template<typename... Args>
void Write(const std::string& format, const Args&... args) {
    int formatSize = std::snprintf(nullptr, 0, format.c_str(), args...);
    
    std::unique_ptr<char[]> str = std::make_unique<char[]>(formatSize);
    std::snprintf(str.get(), formatSize, format.c_str(), args...);

    std::string strFormat = str.get();
}

TEST_CASE("NetWork::ThreadSafeQueue") {
    NetWork::ThreadSafeQueue<std::string> queue;
    queue.Push("hello");
    queue.Pop();
    queue.Pop();
    
    // std::string path = "./Log/log.txt";
    // std::filesystem::path p(path);
    // if (!std::filesystem::exists(p.parent_path()))
    //     std::filesystem::create_directories(p.parent_path());
    // std::ofstream out(path, std::ios_base::app);
    // out << "hello \n world" << std::endl;
    // out.close();
    
    Write("a: %d, f: %f", 1, .5f);
}